<?php
class IndexController extends Controller
{
    function __construct()
    {
        $this->loadLibrary('utility');
    }

    function index($page = 1)
    {
        $view = $this->loadView('index');
        $this->loadModel('category',TRUE);
        $this->loadModel('index');
        $this->loadModel('ad',TRUE);
        
        $data = NULL;
        $cat_list = array();
        $this->models['category']->getCategories(0, $cat_list);
        
        $data['cat_list'] = $cat_list;
        $data['ad_list'] = $this->models['ad']->getAd();
        $view->setBlockData($data, 'cat_list');
        $view->setBlockData($data, 'adv');
        $data['album_items'] = $this->models['index']->getLastestAlbum();
        $data['lastest_news'] = $this->models['index']->getLastestNews($page - 1);
        $data['page'] = $page;
        $data['current_page'] = 'index';
        $view->setBlockData($data,'menu');
        $view->setBlockData($data);
        $view->setBlockData('Trang chủ','title');
        $view->addJs('jquery.tools.min');
        $view->render();
    }
}
 
